﻿using Se.Model.Template.Card;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Se.Model.GameModel.Card.Skill
{
    /// <summary>
    /// 技能类型
    /// </summary>
    public abstract class CardSkillBase
    {
        /// <summary>
        /// 配置
        /// </summary>
        public CardSkillTemplate Template { get; set; }

        /// <summary>
        /// 释放技能的玩家
        /// </summary>
        public CardPlayer ActionPlayer { get; private set; }

        /// <summary>
        /// 被释放的玩家
        /// </summary>
        public Dictionary<int, CardPlayer> OnActionPlayer { get; private set; }

        /// <summary>
        /// 技能是否能用
        /// </summary>
        public bool Enabled { get; set; }

        /// <summary>
        /// 判断施放条件
        /// </summary>
        /// <returns></returns>
        public virtual bool CheckCondition()
        {
            switch (this.Template.StartCondtionType)
            {
                case SkillConditionType.Male:
                    if (this.OnActionPlayer.Any(player => player.Value.BossTemplate.Gender != CardGender.Male)) return false;
                    break;
                case SkillConditionType.Femail:
                    if (this.OnActionPlayer.Any(player => player.Value.BossTemplate.Gender != CardGender.Famale)) return false;
                    break;
                case SkillConditionType.Color:
                    //TODO 判断花色
                    break;
            }


            return true;
        }

        /// <summary>
        /// 施放技能
        /// </summary>
        /// <returns></returns>
        public virtual bool Action()
        {
            return true;
        }

        /// <summary>
        /// 被释放时
        /// </summary>
        /// <returns></returns>
        public virtual bool OnAction()
        {
            return true;
        }

        /// <summary>
        /// 影响其他技能
        /// </summary>
        /// <param name="effectedSkill"></param>
        public virtual void EffectSkill(CardSkillBase effectedSkill)
        {

        }
    }
}
